define(function () {
    var post = function (url,params,callback) {
        var contentType =  params.contentType || 'application/json; charset=UTF-8';
        $.ajax({
            url:url||'',
            type:'POST',
            data:params,
            contentType:contentType,
            success:function (res) {
                if(res.code == 0){
                    callback&&callback(res);
                }else{
                    console.log('error: '+url);
                }
            },
            error:function () {
                console.log('error: '+url);
            }

        })
    }
    var get = function (url,params,callback) {
        var contentType = params.contentType || 'application/x-www-form-urlencoded; charset=UTF-8';
        $.ajax({
            url:url||'',
            type:'GET',
            data:params,
            contentType:contentType,
            success:function (res) {
                if(res.code == 0){
                    callback&&callback(res);
                }else{
                    console.log('error: '+url);
                }
            },
            error:function () {
                console.log('error: '+url);
            }

        })
    };
    var config = {
        getCodePhoneApi:'/jsp/getCodePhone'
    };
    return {
        zyhPost: post,
        zyhGet: get,
        config:config
    }
});